<?php if(isset($storeProducts) && is_array($storeProducts) && !empty($storeProducts)){?>
			<table class="display" cellpadding="10" cellspacing="10">			
			<tr>			
			<?php
			// liczba rekordow
			$catsCnt = count($storeProducts);
			$columns = 3;
			
			foreach ($storeProducts as $k => $storeProduct):
			?>
			
			<?php     	
				if(($k+1) % $columns == 0) { 
					echo "<td width=\"".(100/$columns)."%\" valign=\"top\" align=\"center\" class=\"last\">";
			?>
				<div class="image-icons-list">			
				<?php echo $this->Html->link($fileUpload->image($storeProduct['StoreUpload']['name'],array('autoResize'=>true,'width'=>200,'imagePathOnly'=>false))
					, array('action' => 'view', $storeProduct['StoreProduct']['id'],Inflector::slug($storeProduct['StoreProduct']['name'],'-')),array('escape'=>false)); ?>&nbsp;
					<div class="clr"></div>	
				</div>
				<div class="clr"></div>	
				<table cellpadding="0" cellspacing="0" class="display-info-product">
					<tr>
						<td align="left"  valign="bottom">
						<?php echo $storeProduct['StoreProduct']['name']; ?>
						</td>
						<td align="right" class="price"  valign="bottom">
						<?php if($storeProduct['StoreProduct']['price_przecena'] > 0 && $storeProduct['StoreProduct']['price_promocja'] == 0){?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],0,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'] );?></span>
								<br/>  
								<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_przecena'],0,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							 
						<?php }else if( $storeProduct['StoreProduct']['price_promocja'] > 0){?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],0,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange']);?></span>
								<br/>  
								<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_promocja'],0,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							
						<?php }else{?>
								<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],0,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span>
						<?php }?>
						</td>
					</tr>
					<tr>
						<td colspan="2" align="center" valign="middle" class="more-info">
						<?php if($session->check('Auth.User.id')){?>
						<?php echo $html->link($html->image(HOST.'/buttons_add_favourite.png'), 
				        array('plugin'=>'store','controller'=>'products','action' => 'add_favourite', $storeProduct['StoreProduct']['id']),
				        array('escape'=>false,'class'=>'add-favourite-icons','title'=>__('Add Favourite',true))); ?>
				        <?php }?>
						<?php echo $html->link($html->image(HOST.'/see_more.png'), 
				        array('plugin'=>'store','controller'=>'products','action' => 'view', $storeProduct['StoreProduct']['id'],Inflector::slug($storeProduct['StoreProduct']['name'],'-')),
				        array('escape'=>false,'class'=>'see-more-icons')); ?>
				        
				        </td>	
					</tr>
				</table>
			<?php echo "</td></tr>"; 
			      if ($k!=($catsCnt-1)) echo "<tr>"; 
			        } else { 
			       echo "<td width=\"".(100/$columns)."%\" valign=\"top\" align=\"center\">";			    
			?>
				<div class="image-icons-list">	
				<?php echo $this->Html->link($fileUpload->image($storeProduct['StoreUpload']['name'],array('autoResize'=>true,'width'=>200,'imagePathOnly'=>false))
					, array('action' => 'view', $storeProduct['StoreProduct']['id'],Inflector::slug($storeProduct['StoreProduct']['name'],'-')),array('escape'=>false)); ?>&nbsp;
				</div>
				<table cellpadding="0" cellspacing="0" class="display-info-product">
					<tr>
						<td align="left" valign="bottom" width="50%">
						<?php echo $storeProduct['StoreProduct']['name']; ?>
						</td>
						<td align="right"  class="price" valign="bottom" width="50%">
						<?php if($storeProduct['StoreProduct']['price_przecena'] > 0 && $storeProduct['StoreProduct']['price_promocja'] == 0){?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],0,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'] );?></span>
								<br/> 
								<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_przecena'],0,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							 
						<?php }else if( $storeProduct['StoreProduct']['price_promocja'] > 0){?>
								<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],0,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange']);?></span>
								<br/> 
								<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_promocja'],0,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							
						<?php }else{?>
								<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],0,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span>
						<?php }?>
						</td>
					</tr>
					<tr>
						<td colspan="2" align="center"  valign="middle" class="more-info">
						
						<?php if($session->check('Auth.User.id')){?>
						<?php echo $html->link($html->image(HOST.'/buttons_add_favourite.png'), 
				        array('plugin'=>'store','controller'=>'products','action' => 'add_favourite', $storeProduct['StoreProduct']['id']),
				        array('escape'=>false,'class'=>'add-favourite-icons','title'=>__('Add Favourite',true))); ?>
				        <?php }?>
				        						
						<?php echo $html->link($html->image(HOST.'/see_more.png'), 
				        array('plugin'=>'store','controller'=>'products','action' => 'view', $storeProduct['StoreProduct']['id'],Inflector::slug($storeProduct['StoreProduct']['name'],'-')),
				        array('escape'=>false,'class'=>'see-more-icons')); ?>
				        </td>	
					</tr>
				</table>
			<?php echo "</td>"; 
			    	}
			 ?> 
			<?php endforeach; ?>
			<?php 	// uzupełnienie ostatniego rekordu
				$numSpaces = $columns - ($catsCnt % $columns); 
			    if ($numSpaces!=0 && $numSpaces != $columns ) { 
			        for ($j=0;$j<$numSpaces;$j++) { 
			        	$last = ($j == $numSpaces -1) ? "class=\"last\"" :"";
			            echo "<td  width=\"".(100/$columns)."%\" {$last}>&nbsp;</td>"; 
			        } 
			        echo "</tr>"; 
			    }
			?>					
					
			</table>
<?php }?>